<template>
  <div>
    <h1>地区信息表修改</h1>
    <table border="1" cellspacing="0">
      <tr>
        <td>地区名称</td>
        <td>地区邮编</td>
        <td>操作</td>
      </tr>
      <tr>
        <td>{{ data.place_name }}</td>
        <td>{{ data.postcode }}</td>
        <td>
          <button @click="amend">修改</button>
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      id: this.$route.query.id,
      data: []
    }
  },
  methods: {
    btn() {
      this.axios.get('regionM/?id=' + this.id)
        .then(res => {
          this.data = res.data
        })
    },
    amend() {
      this.axios.put('regionM/?id=' + this.id)
        .then(res => {
          alert('修改成功')
          this.$router.go(-1)
        })
    }
  },
  mounted() {
    this.btn()
  }
}
</script>

<style scoped>

</style>
